home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 1 / Gold Medal Software Volume 1 (Gold Medal) (1994).iso / prog / tpwprog7.arj / GRDEMO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-07-02  |  1.5 KB  |  64 lines

  1. { grdemo.pas -- Demonstrate GraphDLL and GraphLib }
  2.  
  3. program GrDemo;
  4.  
  5. uses WinTypes, WinProcs, WObjects, GraphLib;
  6.  
  7. type
  8.  
  9.   GrDemoApplication = object(TApplication)
  10.     procedure InitMainWindow; virtual;
  11.   end;
  12.  
  13.   PGrDemoWindow = ^GrDemoWindow;
  14.   GrDemoWindow = object(TWindow)
  15.     procedure Paint(PaintDC: HDC; var PaintInfo: TPaintStruct);
  16.       virtual;
  17.   end;
  18.  
  19.  
  20. { GrDemoApplication }
  21.  
  22. {- Initialize GrDemoApplication object's window }
  23. procedure GrDemoApplication.InitMainWindow;
  24. begin
  25.   MainWindow := New(PGrDemoWindow, Init(nil, 'GrDemo'))
  26. end;
  27.  
  28.  
  29. { GrDemoWindow }
  30.  
  31. {- Paint shapes in window using GraphDLL routines }
  32. procedure GrDemoWindow.Paint(PaintDC: HDC;
  33.   var PaintInfo: TPaintStruct);
  34. var
  35.   OldBrush: HBrush;
  36.   OldPen, NewPen: HPen;
  37. begin
  38.   TWindow.Paint(PaintDC, PaintInfo);
  39.   OldBrush := SelectObject(PaintDC, GetStockObject(hollow_Brush));
  40.   NewPen := CreatePen(ps_Solid, 1, RGB(255, 0, 0));
  41.   OldPen := SelectObject(PaintDC, NewPen);
  42.   Circle(PaintDC, 10, 10, 200);
  43.   Square(PaintDC, 10, 10, 200);
  44.   SelectObject(PaintDC, OldBrush);
  45.   SelectObject(PaintDC, OldPen);
  46.   DeleteObject(NewPen)
  47. end;
  48.  
  49. var
  50.  
  51.   GrDemoApp: GrDemoApplication;
  52.  
  53. begin
  54.   GrDemoApp.Init('GrDemoApp');
  55.   GrDemoApp.Run;
  56.   GrDemoApp.Done
  57. end.
  58.  
  59.  
  60. {--------------------------------------------------------------
  61.   Copyright (c) 1991 by Tom Swan. All rights reserved.
  62.   Revision 1.00    Date: 5/25/1991
  63. ---------------------------------------------------------------}
  64.